package com.mooc.lib_common;

import android.util.DisplayMetrics;

/**
 * @ClassName: PixUtils$
 * @Description: java类作用描述
 * @Author: 魏靳元
 * @CreateDate: 2022/8/17 10:55
 * @UpdateRemark: 更新内容
 * @Version: 1.0
 */
public class PixUtils {
    public static int dp2px(int value){
        float values= MyApplication.getsApplication().getResources().getDisplayMetrics()
                .density*value+0.5f;
        return (int) values;
    }
    public static int getScreenWidth(){
        DisplayMetrics metrics=MyApplication.getsApplication().getResources().getDisplayMetrics();
        return  metrics.widthPixels;
    }
    public static int getScreenHeight(){
        DisplayMetrics metrics=MyApplication.getsApplication().getResources().getDisplayMetrics();
        return  metrics.heightPixels;
    }
} 
